package com.xique.park.bean.transform.web.car;

import com.alibaba.excel.converters.Converter;
import com.alibaba.excel.enums.CellDataTypeEnum;
import com.alibaba.excel.metadata.CellData;
import com.alibaba.excel.metadata.GlobalConfiguration;
import com.alibaba.excel.metadata.property.ExcelContentProperty;


/**
 * 自定义交易类型转换器
 */
public class TransTypeConverter implements Converter<String> {

    @Override
    public Class<String> supportJavaTypeKey() {
        return String.class;
    }

    @Override
    public CellDataTypeEnum supportExcelTypeKey() {
        return CellDataTypeEnum.STRING;
    }

    @Override
    public String convertToJavaData(CellData cellData, ExcelContentProperty excelContentProperty, GlobalConfiguration globalConfiguration) {
        return null;
    }

    @Override
    public CellData<String> convertToExcelData(String value, ExcelContentProperty excelContentProperty, GlobalConfiguration globalConfiguration) {
        switch (value) {
            case "1":
                return new CellData<>("月卡续费");
            case "2":
                return new CellData<>("余额充值");
            case "3":
                return new CellData<>("临时缴费");
            default:
                return new CellData<>("");
        }
    }

}
